package io.renren.common.exception;

/**
 * 状态码
 *
 * @author : zh
 * @date : 2018年10月17日
 * @remark : copy micro-service
 */
public enum ResultCode {

	/** 常用0-999 */
	POPSUCCESS(0, "成功"),
	SUCCESS(1, "成功"),
	MESSAGE_2_JSON_ERROR(995, "参数Json序列化异常"),
	INTERFACE_ERROR(996, "无法访问的接口"),
	DATA_ERROR(997, "数据异常"),
	RPC_FAIL(998, "远程调用超时"),
	SYSTEM_ERROR(999, "系统异常"),

	/** 系统异常 1000-1099 */
	TOKEN_ERROR(1000, "token为空"),
	SESSION_ERROR(1001, "session过期"),
	RAS_ERROR(1002, "验签失败"),
	PARAM_LESS(1003,"缺少参数"),
	PARAM_ERROR(1004,"非法参数"),
	REGISTER_COMPANY_CLOSE (1005,"企业注册暂时关闭,请用手机号注册"),
	TICKET_ERROR(1010, "ticket无效"),
	LATESTVERSION(1011,"当前app已经是最新版本"),
	ERRORSIGNRPOINT(1012, "签到积分未设置"),
	SESSION_VALID(1013, "session未过期"),
	CONFIG_NON_EXISTENT(1014,"配置参数不存在"),
	ANONYMOUS_ACCESS_ERROR(1016,"匿名访问钥匙错误"),
	ANONYMOUS_ACCESS_USED(1017,"匿名访问钥匙被使用"),
	ANONYMOUS_ACCESS_OVERTIME(1018,"匿名访问钥匙超时"),
	SYSTEM_NOT_NEW_VERSION(1019,"没有最新版本"),
	PLEASE_LOG_IN_FIRST (1020,"请先登入"),
	REGISTER_FAIL (1020,"注册失败请重试"),
	USER_HAVE_APPLIED (1021,"手机用户已经申请注册"),
	SAFE_IS_NOT (1022,"接口调用时间太长"),
	USER_NAME_HAVE_APPLIED (1023,"公司名已经申请注册"),
	USER_NAME_IS_ERROR (1024,"公司名错误"),
	MERCHANT_NAME_IS_EXIST (1025,"公司名已经存在"),
	MERCHANT_BRANCH_NAME_IS_EXIST (1026,"分公司名已经存在"),

	/** 用户中心1100-1199 */
	ACCOUNT_NOT_EXIST(1100, "账号不存在"),
	PASSWORD_ERROR(1101, "密码错误"),
	ERRORCOUNT(1102, "账号不符合规则"),
	COUNT_EXIST(1103, "账号已存在"),
	EXISTMOBILE(1104, "该手机号已被注册"),
	NOTEXISTMOBILE(1105,"未找到此手机号"),
	SAMEWITHOLDPWD(1106, "与原密码一致"),
	OTHER_LOGIN_BINDING(1107, "未绑定账号"),
	VERIFY_CODE_CD(1108, "验证码冷却时间中"),
	VERIFY_CODE_ERROR(1109, "验证码错误"),
	VERIFY_CODE_TIMES_LIMIT(1110, "验证码获取太频繁,请1分钟后尝试"),
	MOBILE_IS_BINDING(1111, "该手机号已绑定"),
	USER_IS_DISABLED(1112,"账号被封"),
	USER_ISNOT_REGISTER_MERCHANTS(1113,"用户未申请供应商"),
	USER_ISNOT_REGISTER_SUPPLIER(1115,"用户未申请外协"),



	ERROSENDTYPE(1114, "未知的验证码类型"),
	TAXISNULL(1117,"发票信息不存在"),
	TAXSTATUSNOTNULL(1118, "审核信息已存在"),
	COMMISSIONLOCK(1119,"佣金不足"),
	BANKLOCK(1120, "银行信息不全"),
	ISZERO(1121, "提现金额为0"),

	TAXSTATUS_NOT(1122, "一般纳税人资格未认证"),
	AUDITCOMMISSION(1123,"订单审核中"),
	COLLECT_NOT_GOODS(1124,"暂无收藏收藏商品"),
	COLLECT_ISEMPTY(1125," 收藏已经清空"),
	ACCESSORY_ISEMPTY(1126," 附件已经清空"),
	TAXSTATUS_NOT_UPDATE(1127, "当前状态不能修改"),

	OUT_MAX_COUPON(1130,"该优惠券已领完"),
	ERRORCOUPONCODE(1131, "优惠券码错误"),
	NOABLECOUPON(1132, "优惠券编码不可用"),
	NOAVAILABLECOUPON(1133, "暂无可使用的优惠券"),
	NOHAVECOUPON(1134, "暂无可使用的优惠券"),
	
	USER_MACHINE_VERIFY(1141,"人机验证失败"),
	USER_FALSE_VERIFY(1142,"验证失败,请重新验证"),


	ALREADYSIGNEDIN(1150,"已经签到"),
	POINTLACK(1151, "您的积分不足"),
	POINT_EXCHANGE_FAILURE(1152, "积分兑换失败"),
	MERCHANTS_NON_EXISTENT(1160,"商户不存在"),
	
	BUSINESS_URL_IS_EXISTENT(1170,"营业执照已提交请不要重复提交"),
	
	BUSINESS_LIMIT_CONTROL(1180,"业务限流(支持1条/分钟，5条/小时 ，累计10条/天)"),
	MOBILE_NUMBER_ILLEGAL(1181,"非法手机号"),
	MOBILE_QUANTITATIVE_LIMIT(1182,"服务器手机号码发送验证码数量已达到上限"),


	/** 订单 1200-1299 */
	ADDRESS_NOT_EXIST(1201,"所选地址不存在，请重新选择地址"),
	ORDER_NOT_EXIST(1202,"订单不存在,请刷新页面"),
	ORDER_STATUS_CHANGE(1203,"订单状态已更改,请刷新订单列表"),
	ORDER_ITEM_NOT_EXIST(1204,"订单明细不存在"),
	COMMENT_EXIST(1206,"已评论"),
	GOODS_NOT_SCORE(1207,"非积分购买商品"),
	SCORE_NOG_ENOUGH(1208,"积分不足"),
	GEGION_ILLEGAL(1209,"非法的配送区域"),
	ORDER_GOODS_EMPTY(1210,"商品都卖光啦，再看看其他商品吧"),
	ORDER_FILES_OVERLOAD(1211,"上传附件大于10个，请重新选择附件"),
	ORDER_GOOD_NOT_ENOUGH_STOCK(1212,"下手慢了~部分商品被抢空了"),
	ORDER_GOOD_NULL(1213,"下手慢了~全部商品被抢空了"),
	ORDER_BUGAGAIN_GOOD_PART_NULL(1214,"以下商品卖光啦，先将有货商品加入购物车？"),
	COUPON_NOT_SCORE(1215,"非积分兑换优惠券"),
	CART_INVALID_CARTIDS(1216,"购物车中有失效商品,请删除后再结算"),
	CART_STOCK_CARTIDS(1217,"购物车中有库存不足商品,请修改后再结算"),
	ORDER_QUOTE_ERROR(1218,"报价商品下单失败"),
	VENDOR_NOT_EXIST(1219,"店铺不存在"),
	FREIGHT_TEMPLATE_EXIST(1220,"运费模板不存在"),

	/** 商品 1300-1399 */
	GOODS_NOT_EXIST(1300, "商品不存在"),
	INVALID_SCALE(1301, "商品规格无效"),
	INVALID_CHANGE_PRICE(1302, "商品无变价信息"),
	INVALID_PAPER_PRICE(1303, "大纸价无效"),
	INVALID_SECKILL_NUMBER(1304, "秒杀购买数量无效"),
	GOOD_NOT_ENOUGH_STOCK(1305,"商品库存不足"),
	GOOD_NOT_MIN_STOCK(1306,"商品不满足最小起订量"),
	GOODS_NOT_EXIST_INFO(1307,"商品信息找不到"),
	CATEGORY_NOT_INFO(1308,"商品分类数据无效"),
	GOODS_BUY_MIX(1309,"超过最大购买数"),
	GOODS_TEMPLETCAT_NOT_EXIST(1310,"没有商品模板分类"),
	GOODS_TEMPLET_NOT_EXIST(1311,"没有商品模板"),
	GOODS_REACHED_UPPER_LIMIT_OF_EXCHANGE(1312, "该积分商品已达到兑换上限"),
	GOODS_HAVE_NO_DEFAULT_PRODUCT(1314,"商品没有默认的sku"),
	NO_MERCHANT_FOR_SPLIT(1315,"没有找到上架此商品的第三方"),

	/**搜索*/
	REFRESH_GOODS_CACHE_ERROR(1350, "刷新商品缓存失败"),
	REFRESH_MERCHANT_CACHE_ERROR(1350, "刷新商户缓存失败"),

	/** 购物车 1400-1499 */
	CART_IS_EMPTY(1401,"购物车是空的"),
	CART_NOT_STOCK(1402,"购物车里无有效商品"),
	CART_MAX_LIMIT(1403,"购物车数量超过最大限制"),
	CART_NOT_ENOUGH_STOCK(1404,"购物车商品库存不足"),
	CART_ADD_ERROR_CRAFT(1405,"添加错误的工艺"),
	CART_TRUSSUP_NOT_UPDATE_NUM(1406,"关联商品不能修改数量"),
	CART_NOT_ADD_NOT_VALID(1407,"失效商品不能加入购物车"),
	CART_STORE_NOT_ENOUGH(1408, "购买商品库存不足"),
	CART_NUM_ERROR(1409, "商品数量设置错误"),
	CART_MIN_LIMIT_ERROR(1410, "没有达到最小起订量"),
	CART_NOT_USE_COUPON(1411, "这个优惠券没有达到使用条件"),
	CART_SUPPLIER_USERS_CANNOT_BUY_THEIR_OWN_STORES(1412, "供应商用户不能购买自己门店商品"),
	COUPON_REACHED_UPPER_LIMIT_OF_EXCHANGE(1413, "该优惠券已达到兑换上限"),
	CART_NO_GOODS_TO_PAY(1414,"没有选择要付款的商品"),
	CART_NO_CARTTYPE_TO_PAY(1415,"结算购物车类型错误"),


	ERRORCARTTYPE(1420,"未知的加入购物车类型"),
	MAXGOODSNUM(1421, "超出最大活动购买商品数量"),
	ERRORFILETYPE(1422, "该商品不支持上传附件"),
	ERRORFILESERVER(1423, "上传文件服务异常"),
	ERRORIDCARDS(1424, "未知的购物车id"),
	/** 优惠券 */
	COUPON_IS_EMPTY(1430,"暂无优惠券"),
	GIFT_IS_ERROR(1431,"赠品配置错误"),
	COUPON_NOT_EXIST(1432,"优惠券不存在"),
	COUPON_NOT_CONDITION(1433,"优惠券不满足条件"),
	COUPON_IS_RECEIVE(1434,"优惠券已经领取"),
	COUPON_NOT_USE(1435,"优惠券已不能使用"),
	COUPON_IS_BEFORE(1436,"优惠券还没达到可使用时间"),
	COUPON_IS_AFTER(1437,"优惠券已过期"),
	COUPON_NOT_HAVE_YOU(1438,"优惠券不是你的"),
	ERROR_COUPON_PARAM(1439, "优惠配置错误"),
	COUPON_FAILURE(1440, "优惠券送券失败"),


	/** 支付 1500-1599 */
	ERROR_WX_PAY(1501, "微信支付未知异常"),
	ERROR_UNION_SIGN(1502, "银联验签失败"),
	ERROR_UNION_HTTP(1503, "银联请求失败"),
	CREDIT_NOT_ENOUGH(1504,"信用额度不足"),
	DEPOSIT_NOT_ENOUGH(1504,"预存款额度不足"),
	DEPOSIT_PAY_ERROR(1505,"预存款支付失败，请使用其他方式"),
	CONTINUE_PAYMENT(1506, "需要继续支付"),
	WEIXIN_PAY(1507, "订单已支付"),
	CREDIT_BILL_EXIST(1508, "对账单不存在，请刷新"),
	CREDIT_BILL_PAYMENT(1509, "该对账单已还款，请刷新对账单"),
	CREDIT_DEPOSIT_NOT_ENOUGH(1510, "预存款余额不足，请充值或使用其他支付方式还款"),
	ERROR_APP_PAY(1511, "APP支付异常"),
	ORDER_PAY(1512, "订单已支付,请勿重新支付,如订单状态未更改请联系客服"),
	ORDER_MIDDLE(1513, "订单支付中，请稍后"),
	NOT_DEPOSIT_PAY(1514, "该订单不能使用预存款支付,请选择其他支付方式!"),
	NOT_DEPOSIT_PAY_QUOTE(1515, "报价订单不能使用预存款支付,请选择其他支付方式!"),
	ALIPAY_CALLBACK_ERROR(1516, "支付宝回调失败"),


	PAYMENT_WAIT(1551,"等待支付"),
	PAYMENT_ERROR(1552,"支付失败"),
	PAYMENT_MIDDLE(1553,"支付中"),
	PAYMENT_SUCCESS(1554,"支付成功,请勿重复支付"),
	PAYMENT_NOT_EXIST(1555,"支付单号不存在"),

	/** 1600-1799*/
	QUOTE_NOT_MAIN_ATTRIBUTE(1600, "没有主属性"),
	QUOTE_UNIT_PRICE_FAIL(1601, "单价计算失败"),
	QUOTE_NOT_EXSIT_PRODUCT(1602, "没有查到报价产品"),
	QUOTE_MUST_DEFINITION(1603, "有属性需要填自定义值"),
	QUOTE_ATTRIBUTE_MUTEX(1604,"有选项属性互斥"),
	QUOTE_OPTION_MUTEX(1605,"有选项与选项互斥"),
	QUOTE_MUST_SELECT(1606,"有必选项未选择"),
	QUOTE_LIAN_ERROR(1607,"每本页数必须是联数的倍数"),
	QUOTE_PRICE_NOT_FIND(1608,"您输入的产品价格未找到"),
	QUOTE_DEFINITION_ERROR(1609,"您输入的自定义参数错误"),
	QUOTE_NOT_FIND_CUT(1610,"没有找到机器切法"),
	QUOTE_SIZE_IS_BIG(1611,"长宽尺寸太大"),
	QUOTE_NOT_CAN_USE_MACHINE(1612,"没有合适的机器"),
	QUOTE_NOT_P_VALUE(1613,"没有P数"),
	QUOTE_QUANTITY_ERROR(1614,"自定义数量需大于10000"),
	QUOTE_ZHAN_SIZE(1615,"单粘口超过上机尺寸,请选择其他尺寸或方式"),
	QUOTE_HANDLER_NOT_EXSIT(1616,"报价产品处理器未找到"),
	QUOTE_ERP_DATA_NOT_PART(1617,"配置的分类没有找到对应的部件"),
	QUOTE_NOT_EXSIT_FACTORY(1618,"没有找到可以做此产品的工厂"),
	QUOTE_NOT_EXSIT_FACTORY_RELATION(1619,"暂未找到可以做此产品的工厂"),
	QUOTE_NOT_EXSIT_FACTORY_PRINT(1620,"没有找到可以做此产品的印刷机"),
	QUOTE_NOT_EXSIT_FACTORY_MATERIAL(1621,"没有找到可以做此产品的材料"),
	QUOTE_NOT_EXSIT_FACTORY_CRAFT(1622,"没有找到工艺配价"),
	QUOTE_NOT_EXSIT_FACTORY_CRAFT_ERROR(1623,"没有找到工艺配置非法参数"),
	QUOTE_NOT_EXSIT_GROUP_PRICE(1624,"没有找到组合计价"),
	

	/**1800-1899*/
	SEARCH_REFRESH_GOODS_NULL(1800,"没有商品信息"),
	SEARCH_REFRESH_MERCHANT_NULL(1801,"没有商户信息"),
	;

	private int code;

	private String message;

	public static ResultCode valueOf(int code) {
		for(ResultCode resultCode : values()) {
			if(code == resultCode.code) {
				return resultCode;
			}
		}
		return null;
	}

	private ResultCode(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
